/*读取 /目录下文件名长度大于5的目录结构*/
#include <dirent.h>
#include <stdio.h>
#include <string.h>
int select(const struct  dirent *dir)
{
	if(strlen(dir->d_name)>5)
		return 1;
	else
		return 0;
}

main()
{
	struct dirent **namelist;
	int i,total;
	total = scandir("/",&namelist,select,0);
	if(total<0)
		perror("scandir");
	else
	{
		for(i = 0;i<total ; i++)
		{
			printf("%s\n",namelist[i]->d_name);
			printf("total = %d\n",total);
		}
	}
}
